package com.ekuaitu.kuaitu.adapter;

import android.content.Context;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.base.BaseRcAdapterHelper;
import com.ekuaitu.kuaitu.base.BaseRcQuickAdapter;
import com.ekuaitu.kuaitu.bean.MyMessageBean;
import com.ekuaitu.kuaitu.utils.TimeUtils;

/**
 * Created by Michael Pi on 2016/12/12.
 */

public class MyMessageAdapter extends BaseRcQuickAdapter<MyMessageBean.AttachmentBean.MessageListBean, BaseRcAdapterHelper> {


    public MyMessageAdapter(Context context, int layoutResId) {
        super(context, layoutResId);
    }

    @Override
    protected void convert(BaseRcAdapterHelper helper, MyMessageBean.AttachmentBean.MessageListBean item) {

        if (item.getMessageType().equals("1") || item.getMessageType().equals("3") || item.getMessageType().equals("4")) {
            helper.setImageDrawable(R.id.item_message_icon, context.getResources().getDrawable(R.drawable.icon_speaker_orange));
        } else {
            helper.setImageDrawable(R.id.item_message_icon, context.getResources().getDrawable(R.drawable.icon_message));
        }

        helper.setText(R.id.item_message_title, item.getTitle());
        helper.setText(R.id.item_message_date, TimeUtils.getFormatDate(item.getCreateTime(), "yyyy-MM-dd"));
        helper.setText(R.id.item_message_content, item.getContent());
    }
}
